<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:s="http://jboss.com/products/seam/taglib"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:rich="http://richfaces.org/rich"
                xmlns:a4j="http://richfaces.org/a4j">
    <rich:toolBar height="25"
                  itemSeparator="grid">
        <rich:toolBarGroup id="products">
            <h:outputLink value="#{request.contextPath}/products.seam"
                          title="#{messages.richmenuform_productslinktext}">
                #{messages.richmenuform_productslinktext}
            </h:outputLink>
        </rich:toolBarGroup>
        <rich:toolBarGroup id="pages" itemSeparator="none">
            <a4j:repeat var="_page"
                        value="#{parentPages}"
                        rowKeyVar="_i">
                <h:outputLink value="#{request.contextPath}/page.seam"
                              title="#{_page.title}"
                              styleClass="menulink">
                    <f:param name="pageId"
                             value="#{_page.id}"/>
                    <s:conversationId/>
                    #{_page.title}
                </h:outputLink>
            </a4j:repeat>
        </rich:toolBarGroup>

        <rich:toolBarGroup id="login"
                           itemSeparator="line">
            <s:link rendered="#{!identity.loggedIn}"
                    value="Log In"
                    view="/login.xhtml">
            </s:link>
            <h:commandLink rendered="#{identity.loggedIn}"
                           value="Log out"
                           action="#{identity.logout}"/>
        </rich:toolBarGroup>
        <rich:toolBarGroup id="adminfunctionality"
                           itemSeparator="none"
                           rendered="#{identity.hasRole('admin')}">
            <h:outputLink value="#{request.contextPath}/admin.seam">
                admin
            </h:outputLink>
        </rich:toolBarGroup>
        <rich:toolBarGroup id="shoppingcart" itemSeparator="none">
            Products in Cart: #{userShoppingCart.products.size()}
        </rich:toolBarGroup>
        <rich:toolBarGroup location="right">
            <h:inputText styleClass="search"
                         value="#{searchString}"/>
            <h:commandButton styleClass="searchbutton"
                             action="#{productSearch.search}"
                             value="Search">
                <s:conversationId/>
            </h:commandButton>
        </rich:toolBarGroup>
    </rich:toolBar>
</ui:composition>
